Python is a high-level programming language used in a variety of application domains (e.g., web development, database access, GUI development, etc.). Python application servers that are built on top of a third-party database management system (DBMS)—e.g., SAP HANA®, can interact with that database management system's database. Other foreign application programming languages (e.g., Advanced Business Application Programming (ABAP), Java, Javascript, C, C++, Ruby, etc.) can also interact with a DBMS's database.
Mapping data between database tables and object-oriented programming objects can be done with an ORM (Object Relational Mapping) programming model. This relational mapping maps rows of a database table to objects in the (host) programming language in which the application is written. If the application needs to access data, the ORM framework fetches the data from the database and loads it into the application runtime, which is located on the application server layer. The data is transformed into an ORM object ready to be used by the application.
Conversely if the application creates new data, it creates new objects. If the objects become persisted in the database system, the ORM framework can convert the objects into database rows and pass them to the database system for storage. ORM presents multiple advantages such as abstraction from the underlying database and allows declarative coding (set-based processing).
One Python ORM for SAP HANA is designed by SAP Labs, Palo Alto, Calif. The example code below gives an example of this ORM.
Pseudo Code (1)inputTS = TimeSeries( )result = list( )for ts in inputTS:   if ts.Qty > 200:    schedule=ScheduleSeries(Date=ts.Date, Qty=ts.Qty)     result.append(schedule)
The variable inputTS has been assigned to TimeSeries( ), which is the ORM class representing the table TimeSeries in the SAP HANA database. The variable inputTS corresponds to a list of TimeSeries objects that represent the rows in the table TimeSeries. This example program iterates over each TimeSeries object (i.e., for is in inputTS) and checks if its quantity 2 exceeds 200 (i.e., ts.Qty>200). The result provides all TimeSeries objects that satisfy this condition. The result is also a list of ORM objects representing the SAP HANA table ScheduleSeries (i.e., ScheduleSeries(Date=ts.Date, Qty=ts.Qty)). To store the result, it will be persisted in SAP HANA into the corresponding table ScheduleSeries.
In such a Python program, two database interactions are required between the DBMS database and the Python application server; first to fetch the TimeSeries, and second to persist ScheduleSeries. When multiple database interactions are required, especially when the volume of data to transfer is large, the time required for data transfer can become very important and critically impact the application performance.